# coding=utf-8

from odoo import fields, models, api

class CostDetailList(models.Model):
    _name = 'cost.detail.list'
    _description = '成本核算明细表'

    warehouse_id = fields.Many2one('stock.warehouse',string='仓库')
    project_id = fields.Many2one('project.project',related='warehouse_id.this_project_id',string='项目')
    product_id = fields.Many2one('product.product',string='产品')
    uom_id = fields.Many2one('uom.uom',related='product_id.uom_id',string='单位')
    year = fields.Integer(string='年份')
    month = fields.Integer(string='月份')
    receipts_date = fields.Date(string='核算日期')

    qichu_qty = fields.Float(string='期初数量')
    qichu_price = fields.Float(string='期初单价')
    qichu_total = fields.Float(string='期初金额')

    ru_qty = fields.Float(string='入数量')
    ru_price = fields.Float(string='入单价')
    ru_total = fields.Float(string='入金额')

    chu_qty = fields.Float(string='出数量')
    chu_price = fields.Float(string='出单价')
    chu_total = fields.Float(string='出金额')

    jie_qty = fields.Float(string='结存数量')
    jie_price = fields.Float(digits=(16, 8),string='结存单价')
    jie_total = fields.Float(digits=(16, 2),string='结存金额')
